package SocialNetwork.actions;

import java.util.Map;

import Dominion.Article;
import Dominion.Reviewer;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class AssesPublication extends ActionSupport{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private int id;
	private int mark;
	
	public String execute() {
		Reviewer r = new Reviewer();
		try {
			Map<String, Object> session = ActionContext.getContext().getSession();  // Get session
			r = (Reviewer) session.get("user"); 
			Article ar = new Article(id);
			r.asses_publication(ar, mark); 

			return SUCCESS; 
		}
		catch (Exception e) {
			return ERROR;
		}
	}
	
	public void setIdUnres(String idArticle){
		this.id = Integer.parseInt(idArticle);
	}
	
	public void setCbmarks(String marks){
		this.mark = Integer.parseInt(marks);
	}

}
